package com.ydc.ln.tutorial.j2se.ms;

/**
 * 内存 测试
 * 
 * @author ydc
 * @date 下午12:43:43 2013-7-14
 */
public class Ch0801 {
    public static void main(String[] args) {
        new Ch0801().test002();
    }

    public void test002() {
        MyObj mo1 = new MyObj();
        mo1.num = 1;
        MyObj mo2 = new MyObj();
        mo2.num = 2;
        System.out.println("mo1.num = " + mo1.num + "\tmo2.num = " + mo2.num);
        mo1 = mo2;
        System.out.println("mo1.num = " + mo1.num + "\tmo2.num = " + mo2.num);
        mo1 = null;
        System.out.println("mo1.num = "  + "\tmo2.num = " + mo2.num);
    }

    public void test001() {
        String a = "1";
        String b = "2";
        a = b;
        System.out.println("a:" + a + "\tb:" + b);
        a = null;
        System.out.println("a:" + a + "\tb:" + b);
    }

    class MyObj {
        int num = 0;
    }
}
